package com.wlf.server.common.run;

import cn.hutool.core.thread.ThreadUtil;
import com.wlf.server.common.quartz.QuartzStarted;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * 项目启动后执行方法
 * --@PostConstruct > InitializingBean > ApplicationRunner > CommandLineRunner
 *
 */

@Slf4j
@Component
public class PostRunner implements CommandLineRunner {

    @Override
    public void run(String... args) {
        // 定时任务初始化
        ThreadUtil.execAsync(() -> {
            ThreadUtil.safeSleep(1000 * 10);
            log.info("定时任务启动");
            QuartzStarted.init();
        }, true);
    }
}
